<?php error_reporting(0) ;
ini_set("display_errors", 0 );
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
	<title>Aurora</title>
    <?php echo link_tag('assets/css/padrao.css') . "\n"; ?>
    <?php echo link_tag('assets/css/uniform.default.css') . "\n"; ?>
    <?php echo link_tag('assets/css/facebox.css') . "\n"; ?>
    <?php echo link_tag('assets/css/demo_page.css') . "\n"; ?>
    <?php echo link_tag('assets/css/demo_table_jui.css') . "\n"; ?>
    <?php echo link_tag('assets/css/jquery-ui-1.8.16.custom.css') . "\n"; ?>
    <?php echo link_tag('assets/css/style.css') . "\n"; ?>
    <?php echo link_tag('assets/css/impromptu.css') . "\n"; ?>


    <script type="text/javascript" src="<?php echo base_url() . 'assets/js/jquery-1.6.2.min.js' ?>"></script>
    <script type="text/javascript" src="<?php echo base_url() . 'assets/js/facebox.js' ?>"></script>
    <script type="text/javascript" src="<?php echo base_url() . 'assets/js/jquery.uniform.js' ?>"></script>
    <script type="text/javascript" src="<?php echo base_url() . 'assets/js/jquery.dataTables.js'?>"></script>
    <script type="text/javascript" src="<?php echo base_url() . 'assets/js/disciplina.js'?>"></script>
    <script type="text/javascript" src="<?php echo base_url() . 'assets/js/jquery-ui-1.8.15.custom.min.js'?>"></script>
    <script type="text/javascript" src="<?php echo base_url() . 'assets/js/script.js'?>"></script>
    <script type="text/javascript" src="<?php echo base_url() . 'assets/js/jquery.impromptu.js'?>"></script>
    <script type="text/javascript" src="<?php echo base_url() . 'assets/js/mascara.js'?>"></script>    
    <script type="text/javascript" src="<?php echo base_url() . 'assets/js/calendario.js'?>"></script>
    
   

</head>
<body>
<div id="art-page-background-glare">
        <div id="art-page-background-glare-image"></div>
    </div>
    <div id="art-main">
        <div class="art-sheet">
            <div class="art-sheet-tl"></div>
            <div class="art-sheet-tr"></div>
            <div class="art-sheet-bl"></div>
            <div class="art-sheet-br"></div>
            <div class="art-sheet-tc"></div>
            <div class="art-sheet-bc"></div>
            <div class="art-sheet-cl"></div>
            <div class="art-sheet-cr"></div>
            <div class="art-sheet-cc"></div>
            <div class="art-sheet-body">
                <div class="art-header">
                    <div class="art-header-jpeg"></div>
                    <div class="art-logo">
                        <h1 id="name-text" class="art-logo-name">Aurora</h1>
                        <div id="slogan-text" class="art-logo-text">Sistema Acad&ecirc;mico</div>
                    </div>
                </div>
    
                    <div class="art-nav">
                	<div class="l"></div>
                	<div class="r"></div>
                	<ul class="art-menu">
                		<li>
                                    
                                    <a href="?c=c_main" class="active" ><span class="l"></span><span class="r"></span><span class="t">In&iacute;cio</span></a>
                		</li>
                		<li>
                                    <a href="#"><span class="l"></span><span class="r"></span><span class="t">Acad&ecirc;mico</span></a>
                                    <ul>
                                        <li><a href="#" onClick="javascript: localizarAluno()">Alunos</a></li>
                                        <li>
                                            <a href="#">Notas</a>
                                            <ul>
                                                <li><a href="#" >Bimestrais</a></li>
                                                <li><a href="#" >Depend&ecirc;ncia</a></li>
                                                <li><a href="#" >Hist&oacute;rico</a></li>
                                            </ul>
                                        </li>
                                        <li><a href="#" >Relat&oacute;rios</a></li>

                                    </ul>
                                    
                		</li>
                                <li>
                                    <a href="#" ><span class="l"></span><span class="r"></span><span class="t">Tabelas de Apoio</span></a>
<!--                			<a href="#" onclick="javascript: localizarDisciplina()"><span class="l"></span><span class="r"></span><span class="t">Disciplina</span></a>-->
                			<ul>
                                            <li><a href="#" >Valores</a></li>
                                            <li><a href="#" onClick="javascript: listarDisciplinas()">Disciplinas</a></li>
                                            <li><a href="#" onClick="javascript: localizarFuncionario()">Funcion&aacute;rios</a></li>
                                            <li><a href="#" onClick="javascript: listarGrade()">Grade Hor&aacute;ria</a></li>
                                            <li><a href="#" >Relat&oacute;rios</a></li>
                			</ul>
                		</li>
                                <li>
                                    <a href="#" ><span class="l"></span><span class="r"></span><span class="t">Manuten&ccedil;&atilde;o</span></a>
<!--                			<a href="#" onclick="javascript: localizarDisciplina()"><span class="l"></span><span class="r"></span><span class="t">Disciplina</span></a>-->
                			<ul>
                                            <li><a href="#" >Gerar Novo Ano</a></li>
                                            <li><a href="#" >Gerar Disciplina</a></li>
                                            <li><a href="#" >C&aacute;lculo das Notas Finais</a></li>
                                            <li><a href="#" >C&aacute;lculo das M&eacute;dias Finais</a></li>
                                            <li><a href="#" >Usu&aacute;rios e Senhas</a></li>
                                            <li><a href="#" >Configura&ccedil;&atilde;o</a></li>
                                            <li><a href="#" >Auditoria</a></li>
                                            <li><a href="#" >Exportar</a></li>
                			</ul>
                		</li>
                		<li>
                			<a href="#"><span class="l"></span><span class="r"></span><span class="t">Ajuda</span></a>
                		</li>
                	</ul>
                </div>
<div id="content"></div><br />
<div id="div_body" align="center">
                <div class="art-content-layout">
                    <div class="art-content-layout-row">
                        <div class="art-layout-cell art-content">
                            <div class="art-post">
                                <div class="art-post-tl"></div>
                                <div class="art-post-tr"></div>
                                <div class="art-post-bl"></div>
                                <div class="art-post-br"></div>
                                <div class="art-post-tc"></div>
                                <div class="art-post-bc"></div>
                                <div class="art-post-cl"></div>
                                <div class="art-post-cr"></div>
                                <div class="art-post-cc"></div>
                                <div class="art-post-body">
                            
                            <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
                    <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
                            		<div class="cleared"></div>
                                </div>
                            </div>
              
                        </div>
                    </div>
                </div>
                </div>
                <div class="cleared"></div><div class="art-footer">
                    <div class="art-footer-inner">
                        
                        <div class="art-footer-text">
                            <p><a href="http://www.roga.com.br/2008/escola/instituicao.asp?menu=1">Col&eacute;gio Rogacionista</a> | <a href="#">Contate-nos</a><br />
                                Copyright &copy; 2011.</p>
                        </div>
                    </div>
                    <div class="art-footer-background"></div>
                </div>
        		<div class="cleared"></div>
            </div>
        </div>
        <div class="cleared"></div>

    </div>
    
</body>
</html>
<script>
    function listarGrade(){
        jQuery.ajax( {
            type: "POST",
            url: '?c=c_grade_horaria',
            cache: false,

            beforeSend: function (){
                $('#div_body').addClass("div_carregando");
            },
            complete:  function(){
                    $('#div_body').removeClass("div_carregando");
                   
            },
            success: function(data){

               jQuery('#div_body').html(data);
            }
        });
    }
    function listarDisciplinas(){

        jQuery.ajax( {
            type: "POST",
            url: '?c=c_disciplina&m=listarDisciplina',
            cache: false,

            beforeSend: function (){
                $('#div_body').addClass("div_carregando");
            },
            complete:  function(){
                    $('#div_body').removeClass("div_carregando");
                   
            },
            success: function(data){

               jQuery('#div_body').html(data);
            }
        });
    }
    function localizarDisciplina(){

        jQuery.ajax( {
            type: "POST",
            url: '?c=c_disciplina',
            cache: false,

            beforeSend: function (){
                $('#div_body').addClass("div_carregando");
            },
            complete:  function(){
                    $('#div_body').removeClass("div_carregando");
                    
            },
            success: function(data){

               jQuery('#div_body').html(data);
            }
        });
    }
    
    function localizarFuncionario(){

        jQuery.ajax( {
            type: "POST",
            url: '?c=c_funcionario',
            cache: false,

            beforeSend: function (){
                $('#div_body').addClass("div_carregando");
            },
            complete:  function(){
                $('#div_body').removeClass("div_carregando");
                   
            },
            success: function(data){

               jQuery('#div_body').html(data);
            }
        });
    }
    
    function novoAluno(){

        jQuery.ajax( {
            type: "POST",
            url: '?c=c_aluno&m=cadastrarAluno',
            cache: false,

            beforeSend: function (){
                $('#div_body').addClass("div_carregando");
            },
            complete:  function(){
                    $('#div_body').removeClass("div_carregando");

            },
            success: function(data){

               jQuery('#div_body').html(data);
            }
        });
    }
    
    function atualizarDadosAdicionais(){
        jQuery.ajax( {
            type: "POST",
            url: '?c=c_aluno&m=atualizarDadosAdic',
            cache: false,
            data:{
                alunoId:jQuery('input[id="alunoId"]').val(),
                origemEtnica:jQuery('select[id="origemEtnica"]').val(),//
                dtEntradaPais:jQuery('input[id="dataEntradaPais"]').val(),
                nis:jQuery('input[id="nis"]').val(),
                necEspecial: jQuery("input[name='necEspecial']:checked").val()
            },
            beforeSend: function (){
                $('#div_body').addClass("div_carregando");
            },
            complete:  function(){
                    $('#div_body').removeClass("div_carregando");

            },
            success: function(data){
                if(data == 1){
                    alert("Dados inseridos com sucesso!");
                }
               
            }
        });
    }
    
    function atualizarAluno(){
  
        jQuery.ajax( {
            type: "POST",
            url: '?c=c_aluno&m=atualizarAluno',
            cache: false,
            data:{
                alunoId:jQuery('input[id="alunoId"]').val(),//
                nome:jQuery('input[id="nomeAluno"]').val(),//
                naturalCidade:jQuery('select[id="naturalCidade"]').val(),//
                email:jQuery('input[id="email"]').val(),//
                nacionalidade:jQuery('input[id="nacionalidade"]').val(),//
                estadoCivil:jQuery('select[id="estadoCivil"]').val(),//
                sexo:jQuery('select[id="sexo"]').val(),//
                observacao:jQuery('textarea[id="observacao"]').val(),
                dataMatricula:jQuery('input[id="dataMatricula"]').val(),//
                dataTransferencia:jQuery('input[id="dataTransferencia"]').val(),//
                dataConclusao:jQuery('input[id="dataConclusao"]').val(),//
                dataNascimento:jQuery('input[id="dataNascimento"]').val(),//
                diaPagamento:jQuery('input[id="diaPagamento"]').val(),//
                ingresso: jQuery('select[id="ingresso"]').val(),
                cep :jQuery('input[id="cep"]').val(),//
                logradouro:jQuery('input[id="logradouro"]').val(),//
                complemento:jQuery('input[id="complemento"]').val(),//
                tipoEndereco:jQuery('select[id="tipoEndereco"]').val(),
                bairro:jQuery('input[id="bairro"]').val(),//
                uf:jQuery('input[id="uf"]').val(),//
                cidade:jQuery('input[id="cidade"]').val(),//
                telefone:jQuery('input[id="atelefone"]').val(),//
                celular:jQuery('input[id="acelular"]').val()
            },
            beforeSend: function (){
                $('#div_body').addClass("div_carregando");
            },
            complete:  function(){
                    $('#div_body').removeClass("div_carregando");
                   
            },
            success: function(data){
                alert(data);
               //jQuery('#div_body').html(data);
            }
        });
    }

    function localizarAluno(){

        jQuery.ajax( {
            type: "POST",
            url: '?c=c_aluno',
            cache: false,

            beforeSend: function (){
                $('#div_body').addClass("div_carregando");
            },
            complete:  function(){
                    $('#div_body').removeClass("div_carregando");

            },
            success: function(data){

               jQuery('#div_body').html(data);
            }
        });
    }
    
    function voltarResponsavel(alunoId){
    
        jQuery.ajax( {
            type: "POST",
            url: '?c=c_aluno&m=voltarResponsavel',
            cache: false,
            data:{alunoId:alunoId},
            beforeSend: function (){
                $('#div_body').addClass("div_carregando");
            },
            complete:  function(){
                $('#div_body').removeClass("div_carregando");

            },
            success: function(data){

               jQuery('#tabs-responsavel').html(data);
            }
        });
    
    }

    function cadastrarResponsavel(alunoId){

        jQuery.ajax( {
            type: "POST",
            url: '?c=c_responsavel&m=novoResponsavel',
            cache: false,
            data:{alunoId:alunoId},
            beforeSend: function (){
                $('#div_body').addClass("div_carregando");
            },
            complete:  function(){
                $('#div_body').removeClass("div_carregando");
        
            },
            success: function(data){
                
                $('#div_voltar_resp').css('display','block');
                jQuery.facebox(data);
                //$('#bodyResponsavel').html(data);
//               jQuery.facebox(data);
            }
        });
    }
    
    function novoDocumento(alunoId){

        jQuery.ajax( {
            type: "POST",
            url: '?c=c_documentacao&m=cadastrarDocumento',
            cache: false,
            data:{alunoId:alunoId},
            beforeSend: function (){
                $('#div_body').addClass("div_carregando");
            },
            complete:  function(){
                    $('#div_body').removeClass("div_carregando");
  
            },
            success: function(data){

               jQuery.facebox(data);
            }
        });
    }

    
    function atualizarDadosResponsavel(){
        jQuery.ajax( {
            type: "POST",
            url: '?c=c_responsavel&m=atualizarDadosResponsavel',
            cache: false,
            data:{
                alunoId:jQuery('input[id="alunoId"]').val(),
                nomeResp:jQuery('input[id="aNomeResponsavel"]').val(),
                cpfResp:jQuery('input[id="aCpfResponsavel"]').val(),
                idtResp:jQuery('input[id="aIdtResponsavel"]').val(),
                idtExpResp:jQuery('input[id="aIdtExpResponsavel"]').val(),
                parentesco:jQuery('select[id="aParentesco"]').val(),
                emailResp:jQuery('input[id="aEmailResp"]').val(),
                profissao:jQuery('select[id="aProfissao"]').val(),
                cepResp:jQuery('input[id="aCepResp"]').val(),
                logradouroResp:jQuery('input[id="aLogradouroResp"]').val(),
                bairroResp:jQuery('input[id="aBairroResp"]').val(),
                complementoResp:jQuery('input[id="aComplementoResp"]').val(),
                cidadeResp:jQuery('input[id="aCidadeResp"]').val(),
                ufResp:jQuery('input[id="aUfResp"]').val(),
                telResidencialResp:jQuery('input[id="aTelResidencialResp"]').val(),
                celularResp:jQuery('input[id="aCelularResp"]').val(),
                telefoneTrabalhoResp:jQuery('input[id="aTelefoneTrabalhoResp"]').val(),
                contaResp:jQuery('input[id="aContaResp"]').val(),
                agenciaResp:jQuery('input[id="aAgenciaResp"]').val(),
                responsavelDireto:jQuery('input[id="aResponsavelDireto"]:checked').val(),
                bancoResp:jQuery('select[id="aBancoResp"]').val(),
                tipoEndereco:jQuery('select[id="aTipoEnderecoResp"]').val(),
                debitoAutomatico:jQuery('select[id="aDebitoAutomatico"]').val(),
                chequeDevolvido:jQuery('input[id="aCheque"]:checked').val(),
                txMaterialAberto:jQuery('input[id="aTxMaterial"]:checked').val(),
                responsavelCod:jQuery('input[id="respCod"]').val()
            },
            beforeSend: function (){
                $('#div_update_responsavel').addClass("div_carregando");
            },
            complete:  function(){
                $('#div_update_responsavel').removeClass("div_carregando");

            },
            success: function(data){
               
                if(data == true){
                    
                    alert("Dados inseridos com sucesso!");
                    jQuery(document).trigger('close.facebox');
                }
                    
                
                

            }
        });
    }
    
    function excluirResponsavel(responsavelCod){
        
        var msgOk = "Deseja realmente excluir o responsavel?"
        
         if(confirm(msgOk)){
            jQuery.ajax( {
                type: "POST",
                url: '?c=c_responsavel&m=excluirResponsavel',
                cache: false,
                data:{responsavelCod:responsavelCod},
                beforeSend: function (){
                    $('#div_body').addClass("div_carregando");
                },
                complete:  function(){
                    $('#div_body').removeClass("div_carregando");

                },
                success: function(data){

                    var dados = data.split('@');

                    if(dados[0] == true){

                        $('#tr_'+dados[1]).remove();
                    }

                }
            });
         }
    }

    function gravarDadosResponsavel(){
    
        jQuery("#msg_rome").css("display","none");
        jQuery("#msg_ridt").css("display","none");
        jQuery("#msg_rcpf").css("display","none");
        jQuery("#msg_rexpidt").css("display","none");                
        jQuery("#msg_rparentesco").css("display","none");
        jQuery("#msg_rprofissao").css("display","none");
        jQuery("#msg_rcep").css("display","none");
        jQuery("#msg_rlogradouro").css("display","none");
        jQuery("#msg_rbairro").css("display","none");
        jQuery("#msg_ruf").css("display","none");
        jQuery("#msg_rcidade").css("display","none");
        jQuery("#msg_rtelefone").css("display","none");


        var alunoId             = jQuery('input[id="alunoId"]').val();
        var nomeResp            = jQuery('input[id="nomeResponsavel"]').val();
        var cpfResp             = jQuery('input[id="cpfResponsavel"]').val();
        var idtResp             = jQuery('input[id="idtResponsavel"]').val();
        var idtExpResp          = jQuery('input[id="idtExpResponsavel"]').val();
        var parentesco          = jQuery('select[id="parentesco"]').val();
        var emailResp           = jQuery('input[id="emailResp"]').val();
        var profissao           = jQuery('select[id="profissao"]').val();
        var cepResp             = jQuery('input[id="cepResp"]').val();
        var logradouroResp      = jQuery('input[id="logradouroResp"]').val();
        var bairroResp          = jQuery('input[id="bairroResp"]').val();
        var complementoResp     = jQuery('input[id="complementoResp"]').val();
        var cidadeResp          = jQuery('input[id="cidadeResp"]').val();
        var ufResp              = jQuery('input[id="ufResp"]').val();
        var telResidencialResp  = jQuery('input[id="telResidencialResp"]').val();
        var celularResp         = jQuery('input[id="celularResp"]').val();
        var telefoneTrabalhoResp= jQuery('input[id="telefoneTrabalhoResp"]').val();
        var contaResp           = jQuery('input[id="contaResp"]').val();
        var agenciaResp         = jQuery('input[id="agenciaResp"]').val();
        var responsavelDireto   = jQuery('input[id="responsavelDireto"]:checked').val();
        var bancoResp           = jQuery('select[id="bancoResp"]').val();
        var tipoEndereco        = jQuery('select[id="tipoEnderecoResp"]').val();
        var debitoAutomatico    = jQuery('select[id="debitoAutomatico"]').val();
    
        if(nomeResp == '' || cpfResp == '' || idtResp == '' || idtExpResp == ''
                || parentesco == '' || profissao == '' || cepResp == ''
                || logradouroResp == '' || bairroResp == '' || cidadeResp == '' || ufResp == '' 
                || (telResidencialResp == '' && celularResp == '' && telefoneTrabalhoResp == '')){
                
                if(nomeResp == '') jQuery("#msg_rnome").css("display","block");
                if(idtResp == '') jQuery("#msg_ridt").css("display","block");
                if(cpfResp == '') jQuery("#msg_rcpf").css("display","block");
                if(idtExpResp == '') jQuery("#msg_rexpidt").css("display","block");                
                if(parentesco == '') jQuery("#msg_rparentesco").css("display","block");
                if(profissao == '') jQuery("#msg_rprofissao").css("display","block");
                if(cepResp == '') jQuery("#msg_rcep").css("display","block");
                if(logradouroResp == '') jQuery("#msg_rlogradouro").css("display","block");
                if(bairroResp == '') jQuery("#msg_rbairro").css("display","block");
                if(ufResp == '') jQuery("#msg_ruf").css("display","block");
                if(cidadeResp == '') jQuery("#msg_rcidade").css("display","block");
                if(telResidencialResp == '' && celularResp == '' && telefoneTrabalhoResp == '') jQuery("#msg_rtelefone").css("display","block");
                
                
        }else{
            
                jQuery.ajax( {
                type: "POST",
                url: '?c=c_responsavel&m=gravarResponsavel',
                cache: false,
                data:{
                    alunoId:alunoId,
                    nomeResp:nomeResp,
                    cpfResp:cpfResp,
                    idtResp:idtResp,
                    idtExpResp:idtExpResp,
                    parentesco:parentesco,
                    emailResp:emailResp,
                    profissao:profissao,
                    cepResp:cepResp,
                    logradouroResp:logradouroResp,
                    bairroResp:bairroResp,
                    complementoResp:complementoResp,
                    cidadeResp:cidadeResp,
                    ufResp:ufResp,
                    telResidencialResp:telResidencialResp,
                    celularResp:celularResp,
                    telefoneTrabalhoResp:telefoneTrabalhoResp,
                    contaResp:contaResp,
                    agenciaResp:agenciaResp,
                    responsavelDireto:responsavelDireto,
                    bancoResp:bancoResp,
                    tipoEndereco:tipoEndereco,
                    debitoAutomatico:debitoAutomatico
                },
                beforeSend: function (){
                    $('#div_body').addClass("div_carregando");
                },
                complete:  function(){
                        $('#div_body').removeClass("div_carregando");

                },
                success: function(data){
                    
                    $('#tabs-responsavel').html(data);
                    jQuery(document).trigger('close.facebox');
                    
                }
            });
        }
        

    }

    
    function cadastrarIrmao(irmaoId,alunoId){

        jQuery.ajax( {
            type: "POST",
            url: '?c=c_aluno&m=gravarIrmao',
            cache: false,
            data: {irmaoId:irmaoId,alunoId:alunoId},
            beforeSend: function (){
                $('#div_body').addClass("div_carregando");
            },
            complete:  function(){
                $('#div_body').removeClass("div_carregando");
            },
            success: function(data){
  
                var dados = data.split('@');
  
                if(dados[0] == true) {
                    $('#div_irmao_list').css('display','block');
                    $('#tbAluno').append(dados[1]);
                    $('#dadosIrmao').html('');
//                    $('#fieldIrmao').hide();
                    
                    jQuery(document).trigger('close.facebox');
                }
            }
                
        });
        
    }
    
    function removeIrmao(irmaoCod){
        
        jQuery.ajax( {
            type: "POST",
            url: '?c=c_aluno&m=removeIrmao',
            cache: false,
            data: {irmaoCod:irmaoCod},
            beforeSend: function (){
                $('#div_body').addClass("div_carregando");
            },
            complete:  function(){
                $('#div_body').removeClass("div_carregando");
            },
            success: function(data){
                
                if(data == true){
                   
                     $('#tr_irmao_'+irmaoCod).remove();
     }
            }    
        });
    }
    
    
//  jQuery(document).ready(function(){
//    var loading = $('<img id="loading" style=" position: absolute;" class="" src="<?php echo base_url() . 'assets/images/loading.gif' ?>" />'
//        ).appendTo('#div_body').hide();
//        loading.ajaxStart(function(){
//            $(this).show();
//            $('#div_body').addClass("div_carregando");
//        });
//        loading.ajaxStop(function(){
//            $(this).hide();
//            $('#div_body').removeClass("div_carregando");
//        });
//        
//        
//
//});
    
</script>